define([],function(){
	var cookie = function(){};
	cookie.prototype.setCookie = function (name, value, hours) {
		var d = new Date();
		d.setTime(d.getTime() + hours * 3600 * 1000);
		document.cookie = name + '=' + value + '; expires=' + d.toGMTString();
	};
//this.setCookie("username",1212121,3);
//设置Cookie
	cookie.prototype.getCookie = function (name) {
		var arr = document.cookie.split('; ');
		for (var i = 0; i < arr.length; i++) {
			var temp = arr[i].split('=');
			if (temp[0] == name) {
				return temp[1];
			}
		}
		return '';
	};
//this.getCookie("name")
//删除Cookie
	cookie.prototype.removeCookie = function (name) {
		var d = new Date();
		d.setTime(d.getTime() - 10000);
		document.cookie = name + '=1; expires=' + d.toGMTString();
	};

//removeCookie("name")
//设置过期时间 3天
//设置页面刷新的Token
	cookie.prototype.setRefreshToken = function(refreshToken) {
		if (refreshToken != null && refreshToken != "") {
			this.setCookie("refreshToken", refreshToken, 1 * 60);
			return true;
		}
		return false;
	};
//获得页面刷新的Token
	cookie.prototype.getRefreshToken = function() {
		var refreshToken = 	this.getCookie("refreshToken");
		if (refreshToken != null && refreshToken != "") {
			return refreshToken;
		}
		return false;
	};
//设置追踪视频
	cookie.prototype.setVideoTrack = function(videoSourceId, currentTime) {
		var videoTrack = {

		};
		if (videoSourceId != null && currentTime != null) {
			var videoTrackInCookieSerializable = this.getCookie("videoTrack");
			var videoTrackInCookie = null;
			if (videoTrackInCookieSerializable == null || videoTrackInCookieSerializable == "") {
				videoTrack[videoSourceId] = currentTime;
				this.setCookie("videoTrack", JSON.stringify(videoTrack), 60 * 60 * 24 * 3);
			}else {
				videoTrackInCookie = JSON.parse(videoTrackInCookieSerializable);
				videoTrackInCookie[videoSourceId] = currentTime;
				this.setCookie("videoTrack", JSON.stringify(videoTrackInCookie), 60 * 60 * 24 * 3);
			}
			return true;
		}
		return false;
	};
//获得视频追踪
	cookie.prototype.getVideoTrack = function () {
		var videoTrack = this.getCookie("videoTrack");
		if(videoTrack != null && videoTrack != "" ){
//		console.log(videoTrack);
			return JSON.parse(videoTrack);
		}
		return null;
	};


	cookie.prototype.setAuth = function(seed, authToken) {
		var auth = {

		};
		if (seed != null && seed != "" && authToken != null && authToken != "") {
			auth.seed = seed;
			auth.authToken = authToken;
			this.setCookie("auth",JSON.stringify(auth), 60 * 60 * 24 * 3);
			return true;
		}
		return false;
	};

	cookie.prototype.getAuth = function() {
		var auth = this.getCookie("auth");
		if (auth != null && auth != "") {
			return JSON.parse(auth);
		}
		return null;
	};
	var cookieInstant = new cookie()
	return cookieInstant ;
});













































//var this.setCookie = function this.setCookie(name, value, hours) {
//	var d = new Date();
//	d.setTime(d.getTime() + hours * 3600 * 1000);
//	document.cookie = name + '=' + value + '; expires=' + d.toGMTString();
//}
////this.setCookie("username",1212121,3);
////function test1(Func)
////{
////Func("hello");
////}
////
////
////test1(function(data)
////{
////alert(data);
////});
//
////alert(this.setCookie("user",21212))
////璁剧疆Cookie
//var getCookie = function this.getCookie(name) {
//		var arr = document.cookie.split('; ');
//		for (var i = 0; i < arr.length; i++) {
//			var temp = arr[i].split('=');
//			if (temp[0] == name) {
//				return temp[1];
//			}
//		}
//		return '';
//	}
////this.getCookie("name")
////鍒犻櫎Cookie
//var removeCookie = function removeCookie(name) {
//		var d = new Date();
//		d.setTime(d.getTime() - 10000);
//		document.cookie = name + '=1; expires=' + d.toGMTString();
//	}
//
////removeCookie("name")
////璁剧疆杩囨湡鏃堕棿 3澶�
////璁剧疆椤甸潰鍒锋柊鐨凾oken
//var setRefreshToken = function(refreshToken) {
//	if (refreshToken != null && refreshToken != "") {
//		this.setCookie("refreshToken", refreshToken, 1 * 60);
//		return true;
//	}
//	return false;
//}
////鑾峰緱椤甸潰鍒锋柊鐨凾oken
//var getRefreshToken = function() {
//	var refreshToken = 	this.getCookie("refreshToken");
//	if (refreshToken != null && refreshToken != "") {
//		return refreshToken;
//	}
//	return false;
//}
////璁剧疆杩借釜瑙嗛
//var setVideoTrack = function(videoSourceId, currentTime) {
//	var videoTrack = {
//		
//	};
//	if (videoSourceId != null && currentTime != null) {
//		var videoTrackInCookie = JSON.parse(this.getCookie("videoTrack"));
//		if (videoTrackInCookie == null && videoTrackInCookie == "") {
//			videoTrack[videoSourceId] = currentTime;
//			this.setCookie("videoTrack", JSON.stringify(videoTrack), 60 * 60 * 24 * 3);
//		}else {
//			videoTrackInCookie[videoSourceId] = currentTime;
//			this.setCookie("videoTrack", JSON.stringify(videoTrackInCookie), 60 * 60 * 24 * 3);
//		}
//		return true;
//	}
//	return false;
//}
////鑾峰緱瑙嗛杩借釜
//var getVideoTrack = function () {
//	var videoTrack = this.getCookie("videoTrack");
//	if(videoTrack != null && videoTrack != "" ){
//		return JSON.prase(videoTrack);
//	}銆�
//	return null;
//}
//
//
//var setAuth = function(seed, authToken) {
//	var auth = {
//
//	};
//	if (seed != null && seed != "" && authToken != null && authToken != "") {
//		auth.seed = seed;
//		auth.authToken = authToken;
//		this.setCookie("auth",JSON.stringify(auth), 60 * 60 * 24 * 3);
//		return true;
//	}
//	return false;
//}
//
//var getAuth = function() {
//		var auth = this.getCookie("auth");
//		if (auth != null && auth != "") {
//			return JSON.parse(auth);
//		}
//		return null;
//}
